<!--
 * @Author: 噜噜雯雯 2199987619@qq.com
 * @Date: 2025-05-22 14:32:05
 * @LastEditors: 噜噜雯雯 2199987619@qq.com
 * @LastEditTime: 2025-07-04 15:51:24
 * @FilePath: \巡检管理系统\巡检任务详情
 *
-->
<script setup lang="ts">
import { PropType, reactive } from 'vue'
import { Descriptions, DescriptionsSchema } from '@/components/Descriptions'
import { useDeptStore } from '@/store/modules/dept'
import { useDictStore } from '@/store/modules/dictData'
const DeptStore = useDeptStore()
const DictStore = useDictStore()
DictStore.setDict('fac_y_or_n') //是否
DictStore.setDict('red_type') //红线字典
DictStore.setDict('fac_dict_type') //设施类型1
DictStore.setDict('fac_state') //状态字典1
DictStore.setDict('mc_material') //井盖材质字典1
const DetailSchema = reactive<DescriptionsSchema[]>([
  {
    field: 'facName',
    label: '设施名称'
  },
  {
    field: 'facDictType',
    label: '设施类型',
    slots: {
      default: (data: any) => {
        return DictStore.$state.fac_dict_type?.map((item) => {
          if (item.dictValue == data.facDictType) {
            return item.dictLabel
          }
        })
      }
    }
  },
  {
    field: 'mcMaterial',
    label: '井盖材质',
    slots: {
      default: (data: any) => {
        return DictStore.$state.mc_material?.map((item) => {
          if (item.dictValue == data.mcMaterial) {
            return item.dictLabel
          }
        })
      }
    }
  },
  {
    field: 'facState',
    label: '设施状态',
    slots: {
      default: (data: any) => {
        return DictStore.$state.fac_state?.map((item) => {
          if (item.dictValue == data.facState) {
            return item.dictLabel
          }
        })
      }
    }
  },
  {
    field: 'coId',
    label: '所属公司',
    slots: {
      default: (data: any) => {
        return DeptStore.getDeptName(data.coId)[0]?.deptName
      }
    }
  },
  {
    field: 'operationDate',
    label: '设运日期'
  },
  {
    field: 'isCoAs',
    label: '是否公司资产',
    slots: {
      default: (data: any) => {
        return DictStore.$state.fac_y_or_n?.map((item) => {
          if (item.dictValue == data.isCoAs) {
            return item.dictLabel
          }
        })
      }
    }
  },
  {
    field: 'redType',
    label: '红线',
    slots: {
      default: (data: any) => {
        return DictStore.$state.red_type?.map((item) => {
          if (item.dictValue == data.redType) {
            return item.dictLabel
          }
        })
      }
    }
  },
  {
    field: 'isDeadFac',
    label: '是否截止点',
    slots: {
      default: (data: any) => {
        return DictStore.$state.fac_y_or_n?.map((item) => {
          if (item.dictValue == data.isDeadFac) {
            return item.dictLabel
          }
        })
      }
    }
  },
  {
    field: 'address',
    label: '地址'
  }
])

defineProps({
  currentRow: {
    type: Object as PropType<any>,
    default: () => null
  }
})
</script>

<template>
  <Descriptions
    style="font-size: 12px !important"
    :schema="DetailSchema"
    :data="currentRow || {}"
  />
</template>
